package com.accp.vehiclecare.dao.hzdao;

import com.accp.vehiclecare.vo.hzvo.Serviceitem;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ServiceitemMapper {
    int deleteByPrimaryKey(Integer serviceitemid);

    int insert(Serviceitem record);

    int insertSelective(Serviceitem record);

    Serviceitem selectByPrimaryKey(Integer serviceitemid);

    int updateByPrimaryKeySelective(Serviceitem record);

    int updateByPrimaryKey(Serviceitem record);

    List<Serviceitem>query(@Param("id") Integer id);

    @Delete("DELETE FROM `serviceitem` WHERE `serviceitemid` = #{id}")
    int DeleteServiceitem(@Param("id") Integer id);

    @Insert("INSERT INTO `serviceitem` (`incometypeid`,`serviceitxid`,`serviceitemno`,`serviceitemname`,`siremarks`,`cpricesl`,`vipprice`)\n" +
            "VALUES(#{s.incometypeid},#{s.serviceitxid},#{s.serviceitemno},#{s.serviceitemname},#{s.siremarks},#{s.cpricesl},#{s.vipprice})")
    int addServiceitem(@Param("s")Serviceitem serviceitem);

    @Select("SELECT * FROM `serviceitem`\n" +
            "LEFT JOIN `incometype` ON `serviceitem`.`incometypeid`=`incometype`.`incometypeid`\n" +
            " WHERE `serviceitemid`=#{id}")
    Serviceitem QueryOneserviceitem(@Param("id") Integer id);

    @Update("UPDATE `serviceitem` SET \n" +
            "`incometypeid` = #{s.incometypeid} ,`serviceitemno` = #{s.serviceitemno},`serviceitemname`=#{s.serviceitemname},`siremarks`=#{s.siremarks},`cpricesl`=#{s.cpricesl},`vipprice`=#{s.vipprice}\n" +
            " WHERE `serviceitemid` = #{id}")
    int updateOneserviceitem(@Param("s")Serviceitem serviceitem,@Param("id")Integer id);

}